﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Data.SqlClient;


/// <summary>
/// @author Daniel
/// Create on 2010年5月10日22:53:11
/// </summary>

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            showAll();
        }
    }

    void showAll()
    {
        /*
        SIGNON_Operate contact = new SIGNON_Operate();

        SqlDataReader reader = contact.GetAllDatas();

        this.GridView1.DataSource = reader;
        this.GridView1.DataBind();

        reader.Close();
         */ 
    }

    /// <summary>
    /// Button_Go_Click()   [响应进入按钮 函数]
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button_Go_Click(object sender, EventArgs e)
    {

        SIGNON_Operate mySIGNON_Operate = new SIGNON_Operate();

        string sAccNum = null;
        sAccNum = this.TextBox_AccNum.Text.Trim();              // 获取账号信息 [注意：要有Trim()]

        if ("" == sAccNum)
        {
            Alert("账号不能为空");
            return;
        }

        String sTestResult = mySIGNON_Operate.EnterTest(sAccNum);
        if (null == sTestResult)
        {
            Alert("该账号不存在或状态不存在，请重新输入");
            return;
        }

        string sPassWord = null;
        sPassWord = this.TextBox_PassWord.Text.Trim();          // 获取密码信息

        if ("" == sPassWord)
        {
            Alert("密码不能为空");
            return;
        }
        if (sPassWord != sTestResult)
        {
            Alert("密码不正确，请重新输入");
            return;
        }

        //mySIGNON_Operate.Holder_Role                          // 该值为角色值

        Response.Redirect("HomePage.aspx");
    }

    /// <summary>
    /// Alert()     [错误信息提示 函数]
    /// </summary>
    /// <param name="message"></param>
    void Alert(string message)
    {
        Response.Write("<script>alert('" + message + "')</script>");
    }
}

/**
 *
*/